	var	selectionFormulars	= "";
	var	formularFields		= new Array() ;
	var prnDriverName		= ""; //"winspool"
	var prnDeviceName		= ""; //"HP LaserJet 4100 PCL 6"
	var prnPort
				= ""; //"LPT:"
	var prnPaperSource		= 7;  //crPRBinAuto = 7, crPRBinUpper = 1,  crPRBinLower = 2, crPRBinMiddle = 3


//setReportURL(document.all.eReport,"http://127.0.0.1/eReport);
function setReportURL(report,url)
{
	report.parWSDLfile = url+"/eReport.wsdl";			
	report.parWSMLfile = url+"/eReport.wsml";
	report.parServiceName = "eReport";
	report.parPort = "eReportEngineSoapPort";
	report.parNamespace = "http://tempuri.org/eReport/wsdl/";
}

// previewReport(document.all.eReport, document.all.eDetector,"report/HSCARP02", "hc", "Internal Cash Sending", false,1, 9);
function previewReport(report, detector, iReportFileName, iReportInit, iReportTitle, canPrint,  paperOrientation, paperSize)
{
	report.reportFilename = iReportFileName;//"report/HSCARP02";
	report.reportInit = iReportInit;//"hc";
	report.selectionFormula = selectionFormulars;
	
	for(i = 0 ; i < formularFields.length ; i++) 
	{
		report.addFormulaField(formularFields[i][0], formularFields[i][1]);
	}	

	report.generateReport();
	
	var rep = report.eReportObject;
		if(prnDeviceName == "")
		{
		var prns = detector.getPrinters(); //get all printer on this computer
		var	prn = prns(1); //get defalut printer
 
			rep.selectPrinter(prn.DriverName, prn.DeviceName, prn.Port);
	
		}
		else 
		{
			rep.selectPrinter(prnDriverName, prnDeviceName, prnPort);
	
		}
		if (paperOrientation == null)
			rep.PaperOrientation = 1; //1 = Portrait, 2 = Landscape
		else
			rep.PaperOrientation = paperOrientation; //1 = Portrait, 2 = Landscape

		if (paperSize == null)
			rep.PaperSize = 9; // 9 = PaperA4, 8 = PaperA3
		else
			rep.PaperSize = paperSize; // 9 = PaperA4, 8 = PaperA3

	rep.PaperSource = prnPaperSource;
//new preview
	report.setAnimationCtrl(true);
	report.setCloseButton(true);
	report.setDrillDown(false);
	report.setExportButton(false);
	report.setGroupTree(true);
	report.setHelpButton(false);
	report.setNavigationControls(true);
	report.setPopupMenu(false);

	if (canPrint == null)
		report.setPrintButton(false);
	else
		report.setPrintButton(canPrint);
		
	report.setProgressControl(true);
	report.setRefreshButton(false);
	report.setSearchControl(false);
	report.setSearchExpertButton(false);
	report.setSelectExpertButton(false);
	report.setStopButton(true);
	report.setToolbar(true);
	report.setZoomControl(true);

	report.preview(iReportTitle);
}

//printReport(document.all.eReport, document.all.eDetector, false, "report/HSCARP02", "hc", 1, 9);
function printReport(report, detector, iPrintDialog ,iReportFileName, iReportInit, paperOrientation, paperSize)
{
	report.reportFilename = iReportFileName;//"report/HSCARP02";
	report.reportInit = iReportInit;//"hc";

	report.selectionFormula = selectionFormulars;

	for(i = 0 ; i < formularFields.length ; i++) 
	{
		report.addFormulaField(formularFields[i][0], formularFields[i][1]);
	}	
	
	report.generateReport();

	var rep = report.eReportObject;
	var repStatus = rep.PrintingStatus;
		if(prnDeviceName == "")
		{
		var prns = detector.getPrinters(); //get all printer on this computer
		var	prn = prns(1); //get defalut printer
 
			rep.selectPrinter(prn.DriverName, prn.DeviceName, prn.Port);
	
		}
		else 
		{
			rep.selectPrinter(prnDriverName, prnDeviceName, prnPort);
	
		}
		if (paperOrientation == null)
			rep.PaperOrientation = 1; //1 = Portrait, 2 = Landscape
		else
			rep.PaperOrientation = paperOrientation; //1 = Portrait, 2 = Landscape

		if (paperSize == null)
			rep.PaperSize = 9; // 9 = PaperA4, 8 = PaperA3
		else
			rep.PaperSize = paperSize; // 9 = PaperA4, 8 = PaperA3

		rep.PaperSource = prnPaperSource;
		rep.printOut(iPrintDialog);
		return repStatus.progress 
}
//destroyReport(document.all.eReport);
function destroyReport(report)
{
	report.destroy();
}

function addCriteria(iKey, itemValue) 
{	
	formularFields[formularFields.length] = new Array(iKey,itemValue) ;
}